home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PCMania 30
/
PCMania CD30.iso
/
pcmania
/
graf30
/
tacs
/
asmutil.asm
< prev
next >
Wrap
Assembly Source File
|
1987-10-06
|
3KB
|
214 lines
memM = 1
?PLM = 0
?WIN = 0
include cmacros.inc
sBegin DATA
assumes DS,DATA
assumes ES,DATA
sEnd DATA
sBegin CODE
assumes CS,CODE
cProc tdosAlloc, <PUBLIC>, <bx>
parmW numParag
cBegin tdosAlloc
mov bx, numParag
mov ah, 48h
int 21h
jnc alloc_ok
xor ax, ax
alloc_ok:
cEnd
cProc tdosFree, <PUBLIC>, <es>
parmW memPtr
cBegin tdosFree
mov es, memPtr
mov ah, 49h
int 21h
cEnd
cProc tlRead, <PUBLIC>, <bx, cx, dx, ds>
parmW fileHandle
parmD buffPtr
parmW buffSize
cBegin tlRead
mov ds, SEG_buffPtr
mov dx, OFF_buffPtr
mov cx, buffSize
mov bx, fileHandle
mov ah, 3fh
int 21h
jnc lread_ok
xor ax, ax
lread_ok:
cEnd
cProc tsetbuf, <PUBLIC>, <es, di>
parmD buff
parmW length
parmW byte
cBegin tsetbuf
mov es, SEG_buff
mov di, OFF_buff
mov cx, length
mov ax, byte
rep stosb
cEnd tsetbuf
cProc tscanbuf, <PUBLIC>, <es, di>
parmD buff
parmW length
parmW byte
cBegin tscanbuf
mov es, SEG_buff
mov di, OFF_buff
mov cx, length
mov dx, cx
mov ax, byte
repz scasb
jz scan10
inc cx
scan10: sub dx, cx
mov ax, dx
cEnd tscanbuf
;
; long getroom(logical_disk)
;
cProc tgetroom, <PUBLIC>
parmW logdisk
cBegin tgetroom
mov ah,36H
mov dx,logdisk
int 21H
mul cx
mul bx
cEnd tgetroom
;
; long tdskspac(logical_disk)
;
cProc tdskspac, <PUBLIC>
parmW logdisk
cBegin tdskspac
mov ah,36H
mov dx,logdisk
int 21H
mov dx,0
cmp ax,0FFFFH
je dsk_out
mov bx,dx
mul cx
mul bx
dsk_out:
cEnd tdskspac
;
; char tgetdrv()
;
cProc tgetdrv, <PUBLIC>
cBegin tgetdrv
mov ah,19H
int 21H
mov ah,0
cEnd tgetdrv
;
; char tchgdrv()
;
cProc tchgdrv, <PUBLIC>
parmW logdisk
cBegin tchgdrv
mov ah,0EH
mov dx,logdisk
int 21H
cEnd tchgdrv
;
; int tgetdir(buffer,drive)
;
cProc tgetdir, <PUBLIC,si>
parmW buffer
parmW drive
cBegin tgetdir
mov ah,47h
mov si,buffer
mov dx,drive
int 21h
mov ax,0FFFFh
jc getd99
inc ax
getd99:
cEnd tgetdir
;
; int tchgdir(buffer)
;
cProc tchgdir, <PUBLIC>
parmW buffer
cBegin tchgdir
mov ah,3Bh
mov dx,buffer
int 21h
mov ax,0FFFFh
jc chgd99
inc ax
chgd99:
cEnd tchgdir
cProc bigcopy <FAR,PUBLIC>,<si,di,ds,es>
parmD destination
parmD source
parmD count
cBegin bigcopy
cld ; count moves up
mov cx,OFF_count ; move the count to the cx register
mov di,OFF_destination ; load the destination register
mov ax,SEG_destination
mov es,ax
mov si,OFF_source ; load the source
mov ax,SEG_source ;
mov ds,ax
rep movsb ; move the string
cEnd bigcopy
;****************************************************************************;
; ;
; just like write() call in standard C library, except filename is a ;
; 32-bit pointer and buffer length is a 32-bit (long) integer ;
; ;
;****************************************************************************;
cProc tlpWrite <FAR,PUBLIC>,ds
parmW handle
parmW oset
parmW segval
parmW length
cBegin tlpWrite
mov ax, 4000h ; DOS write call
mov bx, handle ; handle
mov dx, oset ; offset of buffer
mov ds, segval ; segment of buffer
mov cx, length ; low-order part of length
int 21h
jnc wrnoerr
mov ax, 0ffffh ; -1 means error
wrnoerr:
cEnd tlpWrite
sEnd
end